package leecode

import "sort"

func findGCD(nums []int) int {
	sort.Ints(nums)
	minNum := nums[0]
	maxNum := nums[len(nums)-1]
	for minNum != 0 {
		temp := maxNum % minNum
		maxNum = minNum
		minNum = temp
	}
	return maxNum
}
